﻿<Window x:Class="ScreenCatcher.View.Host"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:vm="clr-namespace:ScreenCatcher.ViewModel;assembly=ScreenCatcher.ViewModel"
        xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification"
        xmlns:controls="clr-namespace:ScreenCatcher.View.Controls"
        mc:Ignorable="d"
        Title="Screen Catcher"
        Height="350"
        Width="525"
        Style="{StaticResource ChromeWindowStyle}"
        vm:StandardCommands.LoadCommand="{Binding Path=LoadCommand}"
        vm:StandardCommands.UnloadCommand="{Binding Path=UnloadCommand}">
    <!--<Window.Resources>
        <ObjectDataProvider x:Key="MainViewModelProvider" ObjectType="vm:MainViewModelProvider" MethodName="Create" />
    </Window.Resources>
    <Window.DataContext>
        <DynamicResource ResourceKey="MainViewModelProvider" />
    </Window.DataContext>-->
    <Grid>
        <controls:Catcher x:Name="MainCatcher"
                          HadCaught="{Binding Path=(vm:WindowProperties.HadCaughtNotificationFileName), 
                            RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
        <tb:TaskbarIcon
            IconSource="Resources/Main.ico"
            ToolTipText="{Binding Title,RelativeSource={RelativeSource FindAncestor,AncestorType=Window}}">
            <tb:TaskbarIcon.TrayToolTip>
                <Border
                    Background="{StaticResource NormalBrush}"
                    BorderBrush="{StaticResource ActiveBrush}"
                    BorderThickness="2"
                    Width="150"
                    Height="30">
                    <TextBlock
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Text="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Border}},
                            Path=(tb:TaskbarIcon.ParentTaskbarIcon).ToolTipText}"/>
                </Border>
            </tb:TaskbarIcon.TrayToolTip>
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu>
                    <MenuItem
                        Header="Настройки"
                        Click="OpenSettings"/>
                    <MenuItem
                        Header="Выход"
                        Click="Close"/>
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>
        </tb:TaskbarIcon>
    </Grid>
</Window>